package cn.edu.sjtu.se.peakfactory.dao.impls.hibernate;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;

import cn.edu.sjtu.se.lchang.socialnetwork.dao.impls.hibernate.BaseDAOImpl;
import cn.edu.sjtu.se.peakfactory.dao.bean.Brand;
import cn.edu.sjtu.se.peakfactory.dao.interfaces.BrandDAO;

public class BrandDAOImpl extends BaseDAOImpl<Brand> implements BrandDAO {

	@Override
	public List<Brand> searchBrandByName(String brandName) {
		DetachedCriteria criteria = DetachedCriteria.forClass(Brand.class);
		criteria.add(Restrictions.like("name", brandName, MatchMode.ANYWHERE));
		return findByCriteria(criteria);
	}
}
